/**
 * Description: 从有名管道中读取
 * File: fifo_read.c |Time: 2021-04-06 16:07
 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int main(int argc, char *argv[])
{
    int fd = open("fifo", O_RDONLY);

    char buf[100];

    while(1) {
        memset(buf, 0, sizeof(buf));
        read(fd, buf, sizeof(buf));

        printf("read: %s\n", buf);
    }

    return 0;
}
